import { _decorator, Component, Node, find, Prefab } from "cc";
const { ccclass, property } = _decorator;

@ccclass("test")
export class test extends Component {

    onLoad () {
        window.ResMgr.LoadRes("coco1", Prefab, null);
        window.ResMgr.LoadRes("coco1", Prefab, function(err,path){
            if (err==null) {
                let p = window.ResMgr.GetInstance("coco1");
                if (p) {
                    find("Canvas").addChild(p);
                }
            }
        });
        window.ResMgr.LoadPrefab("coco2", true, function(err,prefab){
            if (err==null) {
                find("Canvas").addChild(prefab);
            }
        });
    }

    ReleaseP1 () {
        window.ResMgr.ReleaseInstance("coco1");
    }

    DeleteP1 () {
        cc.find("Canvas/coco1").destroy();
    }

    DeleteP2 () {
        cc.find("Canvas/coco2").destroy();
    }
}
